package com.riekoff.particlecubeworld.editor.visual;

import cc.creativecomputing.CCApp;
import cc.creativecomputing.graphics.CCDrawMode;
import cc.creativecomputing.graphics.CCGraphics;

public class APlaneVisual implements AVisual{
	
	private CCApp _myApp;
	
	public APlaneVisual(CCApp theApp){
		_myApp = theApp;
	}

	@Override
	public void draw(CCGraphics g) {
		float aspect = (float)_myApp.height / _myApp.width;
		
		g.beginShape(CCDrawMode.QUADS);
		g.textureCoords(0, 0, 0);
		g.textureCoords(1, 0, 0, 1, aspect);
		g.vertex(-_myApp.width/2, -_myApp.height/2);
		g.textureCoords(0, 1, 0);
		g.textureCoords(1, 0, 0, 1, aspect);
		g.vertex( _myApp.width/2, -_myApp.height/2);
		g.textureCoords(0, 1, aspect);
		g.textureCoords(1, 0, 0, 1, aspect);
		g.vertex( _myApp.width/2,  _myApp.height/2);
		g.textureCoords(0, 0, aspect);
		g.textureCoords(1, 0, 0, 1, aspect);
		g.vertex(-_myApp.width/2,  _myApp.height/2);
		g.endShape();
	}

}
